package org.ccay.security.entity;

import java.io.Serializable;

/**
 * 角色
 * @author chaowangbang
 * @since 2017年2月5日
 */
public class Role implements Serializable{
	
	public static final Role DEFAULT_ROLE;
	
	static{
		DEFAULT_ROLE = new Role(0L,"默认角色");
	}
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public Role() {
	}
	

	public Role(Long id, String name) {
		super();
		this.id = id;
		this.name = name;
	}
	
	/**
	 * 角色id
	 */
	private Long id;
	/**
	 * 角色名称
	 */
	private String name;
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (id ^ (id >>> 32));
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Role other = (Role) obj;
		if (id != other.id)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
	

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Role [id=");
		builder.append(id);
		builder.append(", name=");
		builder.append(name);
		builder.append("]");
		return builder.toString();
	}
	
}
